package com.zdd.ehe.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdd.ehe.entity.PriceData;
import com.zdd.ehe.entity.Role;
import com.zdd.ehe.mapper.PriceDataMapper;
import com.zdd.ehe.service.IPriceDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ZhuiZhu
 * @since 2023-03-24
 */
@Service
public class PriceDataServiceImpl extends ServiceImpl<PriceDataMapper, PriceData> implements IPriceDataService {

    @Resource
    private PriceDataMapper priceDataMapper;
    /**
     * 分页查询价格列表
     *
     * @param page
     * @return
     */
    @Override
    public Page<PriceData> getAllPrice(Page<PriceData> page) {
        Page<PriceData> pagex = priceDataMapper.getAllPrice(page);
        return pagex;
    }


    /**
     * 添加价格数据接口
     * @param priceData
     * @return
     */
    @Override
    public int addPriceData(PriceData priceData) {
        int r = priceDataMapper.insert(priceData);
        return r;
    }

    @Override
    public int updatePriceDataById(PriceData priceData) {
        return priceDataMapper.updateById(priceData);
    }
}
